﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace ArgusLib.Controls
{
	public class CheckBox: System.Windows.Forms.CheckBox
	{
		private Color backColor;

		public override Color BackColor
		{
			get
			{
				return base.BackColor;
			}
			set
			{
				this.backColor = value;
				if (this.Checked == false || this.Appearance != System.Windows.Forms.Appearance.Button)
				{
					base.BackColor = value;
				}
			}
		}
		public Color CheckedButtonColor { get; set; }

		public CheckBox()
			: base()
		{
			this.UseVisualStyleBackColor = false;
			this.BackColor = Color.Black;
			this.ForeColor = Color.White;
			this.CheckedButtonColor = Color.DarkBlue;
		}

		protected override void OnCheckedChanged(EventArgs e)
		{
			if (this.Appearance == System.Windows.Forms.Appearance.Button)
			{
				if (this.Checked == true)
				{
					base.BackColor = this.CheckedButtonColor;
				}
				else
				{
					base.BackColor = this.backColor;
				}
			}
			base.OnCheckedChanged(e);
		}
	}
}
